home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK2.toast / Development Kits (Disc 2) / QuickDraw GX / Programming Stuff / Sample Code / Printing Samples / Applications… / Banana Jr. ƒ / panels.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-10  |  1.7 KB  |  80 lines  |  [TEXT/KAHL]

  1. /*
  2.     panels.c 
  3.     
  4.     This file contains the routines for handling panels.
  5.  
  6.     Created        9/2/92        - Dave Hersey
  7.  
  8.     ----------------------------------------------
  9.  
  10.     2/1/93    debugged and plopped on GX CD.  - dmh
  11.     9/93    updated to run with the ß2 "GXified" interface files - PLA
  12.     3/94    updated for B4 - dmh
  13.     8/94    universalized - dmh
  14. */
  15.  
  16. #include <stdio.h>
  17. #include <font library.h>
  18. #include <graphics libraries.h>
  19. #include <graphics toolbox.h>
  20. #include <graphics debugging.h>
  21. #include <qd library.h>
  22. #include <PrintingManager.h>
  23. #include <PrintingResTypes.h>
  24. #include <PrintingMessages.h>
  25. #include <Collections.h>
  26.  
  27. #include "Banana Jr.h"
  28.  
  29.  
  30. OSErr PageFormatDialog(gxFormat aFormat, StringPtr title, gxDialogResult *result)
  31. {
  32.     OSErr    err;
  33.     
  34.     err = SetUpByPagePanel(aFormat, gAppResRefNum);
  35.     
  36.     if (!err)
  37.         err = Forward_GXFormatDialog(aFormat, title, result);
  38.         
  39.     return err;
  40. }
  41.  
  42.  
  43. OSErr SetUpByPagePanel(gxFormat aFormat, short ourResFile)
  44. {
  45.     OSErr                        err;
  46.     Collection                    fmtCollection;
  47.     gxPanelSetupRecord            panelInfo;
  48.     T_BananaCollection            bananaConfig;
  49.     
  50.     fmtCollection = GXGetFormatCollection(aFormat);
  51.  
  52.     err = GetCollectionItem(fmtCollection, kBananaCollectionType,
  53.                               gxPrintingTagID, nil, &bananaConfig);
  54.     
  55.     if (err == collectionItemNotFoundErr)
  56.     {
  57.         bananaConfig.one        = 0;
  58.         bananaConfig.two        = false;
  59.         bananaConfig.three        = false;
  60.         bananaConfig.four        = false;
  61.         
  62.         err = AddCollectionItem(fmtCollection, kBananaCollectionType,
  63.                                 gxPrintingTagID, sizeof(T_BananaCollection),
  64.                                 &bananaConfig);
  65.     }
  66.     
  67.     if (!err)
  68.     {
  69.         panelInfo.panelKind            = gxApplicationPanel;
  70.         panelInfo.panelResId        = kFormatPanelResID;
  71.         panelInfo.resourceRefNum    = ourResFile;
  72.         panelInfo.refCon            = 0;
  73.         
  74.         err = GXSetupDialogPanel(&panelInfo);
  75.     }
  76.  
  77.     return err;
  78. }
  79.  
  80.